package com.bkhc.umc.config;

import com.bkhc.common.annotation.ApiRestController;
import com.bkhc.common.annotation.WebRestController;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
        /**
         * 请求路径添加统一前缀
         *
         * @param configurer
         */
        public void configurePathMatch(PathMatchConfigurer configurer) {
            configurer.addPathPrefix("/", c -> c.isAnnotationPresent(WebRestController.class))
                    .addPathPrefix("/service", c -> c.isAnnotationPresent(ApiRestController.class));
        }

}
